package org.softmed.rest.server.test.creators.testcases.parameters;

import org.restlet.data.Response;
import org.restlet.data.Status;
import org.softmed.rest.server.test.creators.AbstractTestCaseCreator;

public class PostPrimitiveField extends AbstractTestCaseCreator {

	private String fieldName;

	public PostPrimitiveField(String fieldName) {
		this.fieldName = fieldName;
	}

	@Override
	public String testCase(String uri, String elementURI) throws Throwable {

		Response response = creator.postTEXT(elementURI + "/" + fieldName,
				"true");

		setupXMLDoc();

		if (!response.getStatus().equals(Status.SERVER_ERROR_NOT_IMPLEMENTED))
			return elementURI;

		if (doc != null && doc.getDocumentElement() != null)
			return elementURI;

		creator.getTestCase().setSucess(true);

		return elementURI;
	}
}
